package main;
/**
 * This is the Store class. It is an inventory with buying and selling functionality.
 * @author Jarvis
 *
 */
public class Store extends Inventory {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -5593962634647012526L;
	/** double array of the prices of items in the story. Should be indexed
	 * with the ID static variables.
	 */
	private double[] prices;
		
	
	/** 
	 * default constructor for the store. You shouldn't have to use it.
	 */
	public Store() {
		super();
		prices = new double[]{50.0,2.0,7.0,15.0,20.0,30.0};
	}
	
	/**
	 * Store construction which alters prices by a multiplier
	 */
	public Store(double multiplier) {
		super();
		prices = new double[]{50.0,2.0,7.0,15.0,20.0,30.0};
		for(int i=0; i<prices.length; i++){
			prices[i]*=multiplier;
		}
	}
	
	/**
	 * the general use constructor.
	 *
	 * @param quantity the quantity
	 * @param prices the prices
	 */
	public Store(int[] quantity, double[] prices) {
		super(quantity);
		this.prices = prices;
	}
	
	/**
	 * The buy method. It is pretty straight forward. decrements the store quantity
	 * and the travelgroup's money increments the travelgroups quantity also increments
	 * the weight accordingly
	 * @param itemID the id number of the item
	 * @param qty the number of that item to buy
	 * @param group the travel group making the purchase.
	 */
	public void buyFromStore(int itemID, int qty, TravelGroup group) {
		Inventory pack = group.getPack();
		
		group.setMoney(group.getMoney()-(prices[itemID]*qty));
		pack.getQuantity()[itemID]+=qty;
		pack.setTotalWeight(pack.getTotalWeight()+(WEIGHTS[itemID]*qty));
		
		quantity[itemID]-=qty;
	}
	
	
	/**
	 * Gets the price oxen.
	 *
	 * @return the price oxen
	 */
	public double getPriceOxen() {
		return prices[OXEN_ID];
	}


	/**
	 * Sets the price oxen.
	 *
	 * @param priceOxen the new price oxen
	 */
	public void setPriceOxen(double priceOxen) {
		prices[OXEN_ID] = priceOxen;
	}


	/**
	 * Gets the price food.
	 *
	 * @return the price food
	 */
	public double getPriceFood() {
		return prices[FOOD_ID];
	}


	/**
	 * Sets the price food.
	 *
	 * @param priceFood the new price food
	 */
	public void setPriceFood(double priceFood) {
		prices[FOOD_ID] = priceFood;
	}


	/**
	 * Gets the price clothes.
	 *
	 * @return the price clothes
	 */
	public double getPriceClothes() {
		return prices[CLOTHES_ID];
	}


	/**
	 * Sets the price clothes.
	 *
	 * @param priceClothes the new price clothes
	 */
	public void setPriceClothes(double priceClothes) {
		prices[CLOTHES_ID] = priceClothes;
	}


	/**
	 * Gets the price wagon axle.
	 *
	 * @return the price wagon axle
	 */
	public double getPriceWagonAxle() {
		return prices[WAGON_AXLE_ID];
	}


	/**
	 * Sets the price wagon axle.
	 *
	 * @param priceWagonaxle the new price wagon axle
	 */
	public void setPriceWagonAxle(double priceWagonaxle) {
		prices[WAGON_AXLE_ID] = priceWagonaxle;
	}


	/**
	 * Gets the price wagon wheel.
	 *
	 * @return the price wagon wheel
	 */
	public double getPriceWagonWheel() {
		return prices[WAGON_WHEEL_ID];
	}


	/**
	 * Sets the price wagon wheel.
	 *
	 * @param priceWagonWheel the new price wagon wheel
	 */
	public void setPriceWagonWheel(double priceWagonWheel) {
		prices[WAGON_WHEEL_ID] = priceWagonWheel;
	}


	/**
	 * Gets the price wagon tongue.
	 *
	 * @return the price wagon tongue
	 */
	public double getPriceWagonTongue() {
		return prices[WAGON_TONGUE_ID];
	}


	/**
	 * Sets the price wagon tongue.
	 *
	 * @param priceWagonTongue the new price wagon tongue
	 */
	public void setPriceWagonTongue(double priceWagonTongue) {
		prices[WAGON_TONGUE_ID] = priceWagonTongue;
	}
	


	
	
}



